/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2016
 */

package com.jzwl.site.manager.comment.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.jzwl.system.base.controller.BaseController;
import com.jzwl.common.constant.AjaxStatusConstant;
import com.jzwl.common.page.PageObject;
import com.jzwl.site.manager.comment.pojo.*;
import com.jzwl.site.manager.comment.dao.*;
import com.jzwl.site.manager.comment.service.*;

/**
 * SiteArticleComment
 * SiteArticleComment
 * siteArticleComment
 * <p>Title:SiteArticleCommentController </p>
 * 	<p>Description:SiteArticleComment </p>
 * 	<p>Company: </p> 
 * 	@author aotu-code 
 */
@Controller
@RequestMapping("/siteArticleComment")
public class SiteArticleCommentController  extends BaseController {
	
	@Autowired
	private SiteArticleCommentService siteArticleCommentService;
	
	/**
	 * siteArticleCommentlist
	 */
	@RequestMapping(value = "/siteArticleCommentList")
	public ModelAndView siteArticleCommentList(HttpServletRequest request, HttpServletResponse response) {
	
		ModelAndView mov = new ModelAndView();
		createParameterMap(request);
		PageObject po = new PageObject();
		
		try{
			paramsMap.put("isDelete", 0);
			po = siteArticleCommentService.querySiteArticleCommentList(paramsMap);
			
			mov.addObject("list", po.getDatasource());
			mov.addObject("totalProperty", po.getTotalCount());
			mov.addObject("page", po);
			
			mov.addObject("beginDate",paramsMap.get("beginDate"));
			mov.addObject("endDate",paramsMap.get("endDate"));
			
			mov.addObject("isPass", paramsMap.get("isPass"));
			
			mov.setViewName("/manager/comment/list");
		}catch(Exception e){
			e.printStackTrace();
			mov.addObject("msg", "siteArticleComment查询失败");
			mov.setViewName("/error");
		}
		
		return mov;
	}
	
	@RequestMapping(value = "/pass")
	public @ResponseBody Map<String, Object> pass(HttpServletRequest request, HttpServletResponse response) {
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("ajax_status", AjaxStatusConstant.AJAX_STATUS_SUCCESS);
		createParameterMap(request);
		try{
			boolean flag = siteArticleCommentService.pass(paramsMap);
			if(!flag){
				resultMap.put("msg", "修改失败!");
			}else{
				resultMap.put("error", "获取栏目数异常");
			}
		}catch(Exception e){
			e.printStackTrace();
			resultMap.put("error", "获取栏目数异常");
		}
		return resultMap;
	}
	
	
	/**
	 * 逻辑删除siteArticleComment
	 * @param request
	 * @param response
	 * @return
	 */
	
	@RequestMapping(value = "/del")
	public @ResponseBody Map<String, Object> delArticle(HttpServletRequest request, HttpServletResponse response) {
		Map<String,Object> resultMap = new HashMap<String,Object>();
		resultMap.put("ajax_status", AjaxStatusConstant.AJAX_STATUS_SUCCESS);
		createParameterMap(request);
		try{
			boolean flag = siteArticleCommentService.delSiteArticleComment(paramsMap);
			if(!flag){
				resultMap.put("msg", "删除失败!");
			}
		}catch(Exception e){
			e.printStackTrace();
			resultMap.put("error", "获取栏目数异常");
		}
		return resultMap;
	}
	
	
	
}

